package goodenglish.interfaces;

import goodenglish.domain.model.lexicon.Lexicon;
import goodenglish.domain.model.lexicon.LexiconRepository;
import goodenglish.infrastructure.repository.db.LexiconRepositoryDb;
import javafx.scene.control.ChoiceBox;

/**
 * 得到字幕选择框
 * 
 * @author hp
 * 
 */
public class LexiconChoiceBox extends ChoiceBox<Lexicon> {
	public LexiconChoiceBox() {
		LexiconRepository lexiconRepository=BeanFactory.getSingleInstance(LexiconRepositoryDb.class) ;
		this.getItems().addAll(lexiconRepository.findLexicons());
		this.getSelectionModel().selectFirst();
	}

	public Lexicon getSelectLexicon() {
		return (Lexicon) this.getSelectionModel().getSelectedItem();
	}
}
